﻿//=====================================================================================================
// LocalizationLibrary
// The Localization Library is a collection of reusable software components that provide 
// support for localization. This library enables you to localize WPF, Silverlight and WP7 applications.
// (http://localizationlibrary.codeplex.com)
//=====================================================================================================
// Author: Nicola Gallo (Website: www.nicola.gallo.name, Email: nicolagmt@hotmail.it) 
//=====================================================================================================

namespace LocalizationLibrary.Tests.Core
{
    //.NET References
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    // Microsoft References
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    [TestClass]
    public class DynamicResourceDescriptionTest
    {
        [ExpectedException(typeof(ArgumentNullException))]
        [TestMethod]
        public void Thrown_ArgumentNullException_If_DynamicResource_Is_Equals_To_Null()
        {
            DynamicResourceDescription dynamicResourceDesc = new DynamicResourceDescription(null);
        }

        [TestMethod]
        public void Enforce_Localization()
        {
            DynamicResource dynRes = new DynamicResource(Guid.NewGuid().ToString());
            DynamicResourceDescription dynamicResourceDesc = new DynamicResourceDescription(dynRes);
            dynamicResourceDesc.EnforceLocalization(null);
        }

        [TestMethod]
        public void Should_Returns_Localizaed_Language()
        {
            DynamicResource dynRes = new DynamicResource(Guid.NewGuid().ToString());
            dynRes.Add((Language)"it", "Ciao", false);
            dynRes.Add((Language)"en", "Hello", false);
            DynamicResourceDescription dynamicResourceDesc = new DynamicResourceDescription(dynRes);
            Assert.AreEqual(dynamicResourceDesc.GetLocalizedLanguages().Length, 2);
        }
    }
}
